<?php
/**
 * Smarty cat modifier plugin
 *
 * Type:     modifier<br>
 * Name:     mb_substr<br>
 * Date:     April 17, 2009
 * Purpose:  substr 1 string follow unicode format
 * Input:    string to catenate, number characters need substring
 * Example:  {$var|mb_substr:120}
 * @author   thach.le <thach.le@ionetwork.com>
 * @version 1.0
 * @param string
 * @param int
 * @return string
 */
function smarty_modifier_mb_substr($string, $numberCharacter)
{
	if ( mb_strlen($string, "UTF-8") > $numberCharacter )
	{
		return mb_substr($string, 0, $numberCharacter, "UTF-8") . " ...";
	}
	else 
		return $string;
}
?>